import Main from '@/view/main'
import parentView from '@/components/parent-view'

/**
 * iview-admin中meta除了原生参数外可配置的参数:
 * meta: {
 *  hideInMenu: (false) 设为true后在左侧菜单不会显示该页面选项
 *  notCache: (false) 设为true后页面不会缓存
 *  access: (null) 可访问该页面的权限数组，当前路由设置的权限会影响子路由
 *  icon: (-) 该页面在左侧菜单、面包屑和标签导航处显示的图标，如果是自定义图标，需要在图标名称前加下划线'_'
 * }
 */

export default [
  {
    path: '/login',
    name: 'login',
    meta: {
      title: 'Login - 登录',
      hideInMenu: true
    },
    component: () => import('@/view/login/login.vue')
  },
  {
    path: '/',
    redirect: '/home',
    component: Main,
    meta: {
      hideInMenu: true,
      notCache: true
    },
    children: [
      {
        path: '/home',
        name: 'home',
        meta: {
          hideInMenu: true,
          notCache: true,
          title: '首页'
        },
        component: () => import('@/view/main/components/welcome.vue')
      }
    ]
  },
  {
    path: '/role',
    name: 'role',
    meta: {
      icon: 'logo-buffer',
      title: '账户管理',
      hideInMenu: false,
    },
    component: Main,
    children: [
      {
        path: 'role-1',
        name: 'role-1',
        meta: {
          access: ['super_admin'],
          icon: 'md-grid',
          title: '创建用户'
        },
        component: () => import('@/view/components/tables/tables.vue')
      },
      {
        path: 'role-2',
        name: 'role-2',
        meta: {
          icon: 'md-grid',
          title: '用户列表',
          hideInMenu: false,
        },
        component: () => import('@/view/components/tables/tables.vue')
      }
    ]
  },
  {
    path: '/rabc',
    name: 'rabc',
    meta: {
      icon: 'logo-buffer',
      title: '后台权限管理'
    },
    component: Main,
    children: [
      {
        path: 'rabc-1',
        name: 'rabc-1',
        meta: {
          access: ['super_admin', 'admin'],
          icon: 'md-grid',
          title: '功能类型分配'
        },
        component: () => import('@/view/components/tables/tables.vue')
      },
      {
        path: 'rabc-2',
        name: 'rabc-2',
        meta: {
          access: ['super_admin', 'admin'],
          icon: 'md-grid',
          title: '权限类型分配'
        },
        component: () => import('@/view/components/tables/tables.vue')
      },
      {
        path: 'rabc-3',
        name: 'rabc-3',
        meta: {
          access: ['super_admin', 'admin'],
          icon: 'md-grid',
          title: '角色类型分配'
        },
        component: () => import('@/view/components/tables/tables.vue')
      },
      {
        path: 'editor_page',
        name: 'editor_page',
        meta: {
          access: ['super_admin'],
          icon: 'ios-create',
          title: '富文本编辑器'
        },
        component: () => import('@/view/components/editor/editor.vue')
      },
      {
        path: 'icons_page',
        name: 'icons_page',
        meta: {
          access: ['super_admin', 'other'],
          icon: '_bear',
          title: 'other可见类目'
        },
        component: () => import('@/view/components/icons/icons.vue')
      }
    ]
  },
  {
    path: '/multilevel',
    name: 'multilevel',
    meta: {
      icon: 'md-menu',
      title: '咨询管理'
    },
    component: Main,
    children: [
      {
        path: 'level_2_1',
        name: 'level_2_1',
        meta: {
          icon: 'arrow-graph-up-right',
          title: '发布资讯'
        },
        component: () => import('@/view/components/editor/editor.vue')
      },
      {
        path: 'level_2_3',
        name: 'level_2_3',
        meta: {
          icon: 'arrow-graph-up-right',
          title: '资讯置顶'
        },
        component: () => import('@/view/multilevel/level-2-3.vue')
      },
    ]
  },
  {
    path: '/banner',
    name: 'banner',
    meta: {
      icon: 'logo-buffer',
      title: 'Banner管理'
    },
    component: Main,
    children: [
      {
        path: 'banner-1',
        name: 'banner-1',
        meta: {
          icon: 'md-grid',
          title: 'Banner创建'
        },
        component: () => import('@/view/components/tables/tables.vue')
      },
      {
        path: 'banner-2',
        name: 'banner-2',
        meta: {
          icon: 'md-grid',
          title: 'Banner跳转'
        },
        component: () => import('@/view/multilevel/level-2-1.vue')
      },
      {
        path: 'banner-3',
        name: 'banner-3',
        meta: {
          icon: 'md-grid',
          title: 'Banner更换'
        },
        component: () => import('@/view/multilevel/level-2-1.vue')
      },
      {
        path: 'banner-4',
        name: 'banne-4',
        meta: {
          access: ['super_admin'],
          icon: 'ios-create',
          title: 'Banner样式'
        },
        component: () => import('@/view/multilevel/level-2-1.vue')
      }
    ]
  },
  {
    path: '/subject',
    name: 'subject',
    meta: {
      icon: 'logo-buffer',
      title: '专题管理'
    },
    component: Main,
    children: [
      {
        path: 'subject-1',
        name: 'subject-1',
        meta: {
          access: ['super_admin', 'admin'],
          icon: 'md-grid',
          title: '专题发布'
        },
        component: () => import('@/view/components/editor/editor.vue')
      },
      {
        path: 'subject-2',
        name: 'subject-2',
        meta: {
          access: ['super_admin', 'admin', 'other'],
          icon: 'md-grid',
          title: '专题列表'
        },
        component: () => import('@/view/components/tables/tables.vue')
      },
      {
        path: 'subject-3',
        name: 'subject-3',
        meta: {
          access: ['other'],
          icon: 'md-grid',
          title: '专题--other'
        },
        component: () => import('@/view/multilevel/level-2-1.vue')
      }
    ]
  },
  {
    path: '/member',
    name: 'member',
    meta: {
      access: ['super_admin'],
      icon: 'logo-buffer',
      title: '会员管理'
    },
    component: Main,
    children: [
      {
        path: 'member-1',
        name: 'member-1',
        meta: {
          icon: 'md-grid',
          title: '会员信息'
        },
        component: () => import('@/view/components/tables/tables.vue')
      },
      {
        path: 'member-2',
        name: 'member-2',
        meta: {
          icon: 'md-grid',
          title: '会员状态'
        },
        component: () => import('@/view/multilevel/level-2-1.vue')
      }
    ]
  },
  {
    path: '/401',
    name: 'error_401',
    meta: {
      hideInMenu: true
    },
    component: () => import('@/view/error-page/401.vue')
  },
  {
    path: '/500',
    name: 'error_500',
    meta: {
      hideInMenu: true
    },
    component: () => import('@/view/error-page/500.vue')
  },
  {
    path: '*',
    name: 'error_404',
    meta: {
      hideInMenu: true
    },
    component: () => import('@/view/error-page/404.vue')
  }
]
